﻿Class WindowMain

    Private __ControlTutorial As ControlTutorial = New ControlTutorial()
    Private __ControlAction As ControlAction = New ControlAction()
    Private __ControlUsages As ControlUsages = New ControlUsages()

    Sub New()
        MyBase.New()
        Me.InitializeComponent()

        Me.__TutorialOption.IsChecked = True
        __UpdateUiBasedOnSelectedOption()
    End Sub

    Private Sub __UpdateUiBasedOnSelectedOption()
        If Me.__TutorialOption.IsChecked Then
            __TutorialOption.FontWeight = FontWeights.Bold
            __ActionOption.FontWeight = FontWeights.Normal
            __UsagesOption.FontWeight = FontWeights.Normal
            Me.__ContentHost.Children.Clear()
            Me.__ContentHost.Children.Add(__ControlTutorial)
        Else
            If Me.__ActionOption.IsChecked Then
                __TutorialOption.FontWeight = FontWeights.Normal
                __ActionOption.FontWeight = FontWeights.Bold
                __UsagesOption.FontWeight = FontWeights.Normal
                Me.__ContentHost.Children.Clear()
                Me.__ContentHost.Children.Add(__ControlAction)
                __ControlAction.__CurrentExpressionTextbox.Focus()
            Else
                If Me.__UsagesOption.IsChecked Then
                    __TutorialOption.FontWeight = FontWeights.Normal
                    __ActionOption.FontWeight = FontWeights.Normal
                    __UsagesOption.FontWeight = FontWeights.Bold
                    Me.__ContentHost.Children.Clear()
                    Me.__ContentHost.Children.Add(__ControlUsages)
                End If
            End If
        End If
    End Sub

    <PreEmptive.Attributes.Feature("ProjectLink")> _
    Private Sub __ProjectLink_MouseLeftButtonUp(ByVal _sender As Object, ByVal _data As System.Windows.Input.MouseButtonEventArgs) Handles __ProjectLink.MouseLeftButtonUp
        Try
            Process.Start(CType(_sender, Label).Content.ToString())
        Catch _exception As Exception
            MessageBox.Show(_exception.ToString(), "An error occurred while launching the browser.", MessageBoxButton.OK, MessageBoxImage.Error)
        End Try
    End Sub

    <PreEmptive.Attributes.Feature("BlogLink")> _
    Private Sub __BlogLink_MouseLeftButtonUp(ByVal _sender As Object, ByVal _data As System.Windows.Input.MouseButtonEventArgs) Handles __BlogLink.MouseLeftButtonUp
        Try
            Process.Start(CType(_sender, Label).Content.ToString())
        Catch _exception As Exception
            MessageBox.Show(_exception.ToString(), "An error occurred while launching the browser.", MessageBoxButton.OK, MessageBoxImage.Error)
        End Try
    End Sub

    <PreEmptive.Attributes.Feature("EmailLink")> _
    Private Sub __EmailLink_MouseLeftButtonUp(ByVal _sender As Object, ByVal _data As System.Windows.Input.MouseButtonEventArgs) Handles __EmailLink.MouseLeftButtonUp
        Try
            Process.Start("mailto:anjos.silva@gmail.com?subject=Enhancements project feedback")
        Catch _exception As Exception
            MessageBox.Show(_exception.ToString(), "An error occurred while launching the e-mail client.", MessageBoxButton.OK, MessageBoxImage.Error)
        End Try
    End Sub

    <PreEmptive.Attributes.Feature("TutorialOption")> _
    Private Sub __TutorialOption_Checked(ByVal _sender As Object, ByVal _data As System.Windows.RoutedEventArgs) Handles __TutorialOption.Checked
        If Me.IsInitialized Then
            __UpdateUiBasedOnSelectedOption()
        End If
    End Sub

    <PreEmptive.Attributes.Feature("ActionOption")> _
    Private Sub __ActionOption_Checked(ByVal _sender As Object, ByVal _data As System.Windows.RoutedEventArgs) Handles __ActionOption.Checked
        If Me.IsInitialized Then
            __UpdateUiBasedOnSelectedOption()
        End If
    End Sub

    <PreEmptive.Attributes.Feature("UsagesOption")> _
    Private Sub __UsagesOption_Checked(ByVal _sender As Object, ByVal _data As System.Windows.RoutedEventArgs) Handles __UsagesOption.Checked
        If Me.IsInitialized Then
            __UpdateUiBasedOnSelectedOption()
        End If
    End Sub

End Class
